package com.jake.spring.mvc.advice;

import com.jake.spring.mvc.exception.MyException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyRestControllerAdvice {

    @ExceptionHandler
    @ResponseStatus(HttpStatus.OK)
    public String handleMyException(MyException e) {
        return e.getMessage();
    }
}
